|
|
Component
TimerInt
Periodic interrupt
Component Level: High
Category:
CPU Internal Peripherals-Timer
Typical Usage:
(Examples of a typical usage of the component in user code.
For more information please
see the page Component Code
Typical Usage.)
Required component name is "TI1". There are the following two typical usage modes:
(1)
EVENTS.C
int i = 0;
void TI1_OnInterrupt(void)
{
++i;
}
Note: In this case it is recommended to turn off all the methods of the component.
(2)
EVENTS.C
int rpt_cntr = 255, mode = 0;
void TI1_OnInterrupt(void)
{
if( --rpt_cntr==0 ) { // If the event was generated 255times
if( ++mode==3 ) mode = 0; // Select next mode of the period
TI1_SetPeriodMode( mode );// Set new period mode
rpt_cntr = 255; // Set repeat counter
}
}
|